package cc.lj.internal.mobilepay.interfaces.facade;

import cc.lj.internal.core.exception.SysExceptionEnum;
import cc.lj.internal.core.http.HttpResult;
import cc.lj.internal.mobilepay.application.service.RefundQueryAppService;
import cc.lj.internal.mobilepay.interfaces.dto.RefundQueryResponseDTO;
import cc.lj.internal.mobilepay.interfaces.dto.command.RefundQueryCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 统一退款查询接口
 * @author liangxifeng
 * @date 2022-11-30
 */
@RestController
@Slf4j
@Validated
@RequestMapping("refundQuery")
public class RefundQueryController {
    @Resource(name = "refundQueryAppService")
    private RefundQueryAppService appService;

    /**
     * 退款
     * @param command
     * @return
     */
    @PostMapping()
    public HttpResult<RefundQueryResponseDTO> doRefundQuery(@Valid @RequestBody RefundQueryCommand command)
    {
        RefundQueryResponseDTO res = appService.doMain(command);
        return HttpResult.success(SysExceptionEnum.SUCCESS.getCode(),SysExceptionEnum.SUCCESS.getMessage(),res);
    }
}
